<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" 
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://shale.apache.org/validator">

<f:view>
<f:loadBundle var="text" basename="#{basePage.bundleName}"/>
<head>
    <title>#{text['upload.title']}</title>
    <meta name="menu" content="AdminMenu"/>
    <meta name="heading" content="#{text['upload.heading']}"/>
</head>

<p>#{text['upload.message']}</p>

<h:form id="uploadForm" enctype="multipart/form-data" onsubmit="return validateUploadForm(this)">

    <t:message for="file" styleClass="fieldError"/>
	
	<table class="inputFieldsTable">
		<tr>
			<td class="inputLabelColumn">    
				<h:outputLabel for="file" value="#{text['uploadForm.file']}"/>
			</td>
			<td>
				<t:inputFileUpload id="file" value="#{fileUpload.file}" storage="file" required="true" >
					<v:commonsValidator client="true" type="required" arg="#{text['uploadForm.file']}"/>
				</t:inputFileUpload>
			</td>
		</tr>
	</table>

    <span class="buttongroup">
        <h:commandButton value="#{text['button.upload']}" action="#{fileUpload.upload}"
            id="upload" styleClass="button_small"/>
        <h:commandButton value="#{text['button.cancel']}" action="mainMenu" immediate="true"
            id="cancel" styleClass="button_small" onclick="bCancel=true"/>
    </span>
</h:form>

<h2>#{text['upload.templates.title']}</h2>


<p>
    <h:outputFormat value="#{text['upload.templates.newuser']}" escape="false">
	<f:param value="resources/LaunchUserTemplates/NewUserTemplate.xls"/>
    </h:outputFormat>
    <br/>
    <h:outputFormat value="#{text['upload.templates.existinguser']}" escape="false">
	<f:param value="resources/LaunchUserTemplates/ExistingUserTemplate.xls"/>
    </h:outputFormat>
</p>

<v:validatorScript functionName="validateUploadForm"/>

<script type="text/javascript">
    Form.focusFirstElement($('uploadForm'));
    highlightFormElements();
</script>

</f:view>
</html>
